<template>
  <div class="comment-card">
    <div class="top">
      <div class="sub-top">
        <image
          class="avatar"
          :src="userInfo.avatarUrl"
          mode="aspectFit"
          :lazy-load="true"
        />
        <div>
          <span>{{ userInfo.nickName }}</span>
          <div></div>
        </div>
      </div>
      <div class="sub-top">
        
        {{ createTime }}
      </div>
    </div>
    <div class="bottom">
      {{ comment.comment }}
      <div class="location-model">
        <span>{{ comment.geoLocation || '未知位置' }}</span>
        -
        <span>{{ comment.phoneModel || '未知型号' }}</span>
      </div>
    </div>
  </div>
</template>

<script>
  import moment from 'moment';
  export default {
    props: {
      comment: {
        type: Object,
        default: {},
      },
    },
    computed: {
      userInfo () {
        return this.comment.userId;
      },
      createTime () {
        return moment(this.comment.createTime).format('YYYY-MM-DD HH:mm');
      },
    },
  }
</script>

<style lang="less" scoped>
.comment-card {
  margin: 10rpx 0;
  padding: 10rpx;
  background-color: #eee;
  .top {
    display: flex;
    justify-content: space-between;
    .sub-top {
      height: 64rpx;
      display: flex;
      align-items: center;
      color: gray;
      font-size: 12px;
      .avatar {
        width: 64rpx;
        height: 64rpx;
        border-radius: 50%;
        margin-right: 10rpx;
      }
    }
  }
  .bottom {
    margin-top: 20rpx;
    font-size: 12px;
    .location-model {
      color: gray;
      margin-top: 10rpx;
      font-size: 10px;
      text-align: right;
    }
  }
}
</style>